package com.anita.member.domain.model.member;

import lombok.Getter;

/**
 * 手机号验证枚举类
 * @author qiu
 * @date 2025/10/17
 * @description
 */
@Getter
public enum PhoneVerified {
    UNVERIFIED(0,"未验证"),
    VERIFIED(1, "已验证");

    private final int code;
    private final String desc;

    PhoneVerified(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int code() {
        return code;
    }

    public String desc() {
        return desc;
    }

    public static PhoneVerified of(int code) {
        for (PhoneVerified phoneVerified : values()) {
            if (phoneVerified.code == code) {
                return phoneVerified;
            }
        }
        throw new IllegalArgumentException("无效的判断码: " + code);
    }
}
